package com.appspot.categoryeditor.controller;

import java.util.ArrayList;
import java.util.List;

import org.slim3.controller.router.RouterImpl;

public class AppRouter extends RouterImpl {

	public AppRouter() {

		List<String> from = new ArrayList<String>();		
		List<String> to = new ArrayList<String>();
		
		from.add("/users/{userid}");
		to.add("/userpage?userid={userid}");
		
		from.add("/users/{userid}/{categoryid}");
		to.add("/userpage?userid={userid}&categoryid={categoryid}");
	
		from.add("/categories/{userid}");
		to.add("/categories?userid={userid}");

		from.add("/categories/{userid}/{categoryid}");
		to.add("/categories?userid={userid}&categoryid={categoryid}");
		
		String f, t;
		for (int i = 0; i <from.size(); i++) {
			f = from.get(i);
			t = to.get(i);
			addRouting(f, t);
			addRouting(f + "/", t);
		}

	}
	
}
